package org.starlight.user.serivce.impl;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.starlight.delete.DeleteRecordHelper;
import org.starlight.delete.enums.TableEnum;
import org.starlight.user.entity.Ent;
import org.starlight.user.repository.EntRepository;
import org.starlight.user.serivce.EntService;

/**
 * @author huangyong
 * @data 2025/2/28
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class EntServiceImpl implements EntService {
    private final EntRepository entRepository;

    @Override
    public void save(Ent ent) {
        entRepository.save(ent);
    }

    @Override
    public void del(Integer id) {
        DeleteRecordHelper.saveDeleteRecord(TableEnum.ent, entRepository.findById(id).orElse(null));
        entRepository.deleteById(id);
    }
}
